UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'qTejwM/nTnmDQWthChqzm3hNgQOGCUyPpxMjqNtA1HU='
WHERE
key_id = 'd1f5ad389d6e0f474d0ff62972082cfd4990dc76e14817f74139bc9f0a5e03f0'
AND (
token = 'qTejwM/nTnmDQWthChqzm3hNgQOGCUyPpxMjqNtA1HU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)