UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'lKxkGRiicyefcYB+6sFc3o5ySbtG9h7+w/vdiP2EKYs='
WHERE
key_id = '50c63cedef49b2730cabec12b4bddd8d27549420a0acba13f7ef3a26a57aae61'
AND (
token = 'lKxkGRiicyefcYB+6sFc3o5ySbtG9h7+w/vdiP2EKYs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)