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