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