UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'JpcIHESSC2C7g2Mepk94/fgZX4iCYXAtmdjhH/RLlL0='
WHERE
key_id = 'a1acd509771cfb50f0171db9219017b3ce2f41a6156931b620927e5ccf32c6b0'
AND (
token = 'JpcIHESSC2C7g2Mepk94/fgZX4iCYXAtmdjhH/RLlL0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)