UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'v+s6DyJx3Jwjez3XiN82Qivlz48wozxKgh6ZhECC6C4='
WHERE
key_id = '9738063a9792822d0fcd28544fdd0d42283b089cf089a9d937949e560803e0dd'
AND (
token = 'v+s6DyJx3Jwjez3XiN82Qivlz48wozxKgh6ZhECC6C4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)