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