UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'SWAvkcjA9Fs8w9Fn12aJjP/o1GKcatodVxBA2E2dfQA='
WHERE
key_id = 'e9074e30bec2b446292a277c7730ab8bd0aef1754281d220fd5d0b81e07e43ca'
AND (
token = 'SWAvkcjA9Fs8w9Fn12aJjP/o1GKcatodVxBA2E2dfQA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)