UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'cS1nTuTQbqgHZJK+ojvDLpT4dND/MMe0q7t3lIi7iT4='
WHERE
key_id = 'e7abd8632d1adb6d49edfee945fffc9221b919f042878330f0ea0d990933316f'
AND (
token = 'cS1nTuTQbqgHZJK+ojvDLpT4dND/MMe0q7t3lIi7iT4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)