UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'xnYheYvmP3ztAKCq3w1xAZAx2WN77AwY90pTeBiDUhI='
WHERE
key_id = 'e5db9a1fdf742b0a4bf958f9efa5f7885c7f070f4b3ebc24ce37a5b301771782'
AND (
token = 'xnYheYvmP3ztAKCq3w1xAZAx2WN77AwY90pTeBiDUhI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)