UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'a2gYvbdcxdP3dP+GBNZtrPuYidIjok/hDSlaLmX7ky4='
WHERE
key_id = '8c685d9f0a8c8afe690791f176e7b2b27e32c55852fe80eb8f973ade3beea615'
AND (
token = 'a2gYvbdcxdP3dP+GBNZtrPuYidIjok/hDSlaLmX7ky4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)