UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'BTCbY4DDLPMbl1/eKELETpyCahrQx1AasBZ4JpsIcm8='
WHERE
key_id = '20790edbbe2880b08b509155617e38e7cefe6fc16a666bc938e5cbf9982b568c'
AND (
token = 'BTCbY4DDLPMbl1/eKELETpyCahrQx1AasBZ4JpsIcm8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)