UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '5AvU8ahT/GCjKCcA0MHu7SgMQqq+hSw1YaKxszI397w='
WHERE
key_id = 'ae2e1602e845ddec4f54623dc685dbb39f8cc563c552cadca7dcbfafd9df53ce'
AND (
token = '5AvU8ahT/GCjKCcA0MHu7SgMQqq+hSw1YaKxszI397w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)