UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'KXTx7aMh1O7pN/ioPlcPt0O8NKB8/57CJyrb53Hd1GM='
WHERE
key_id = 'c41b8a66beffffd67a8d913845631593420769d707a5e32b72046eb097c70881'
AND (
token = 'KXTx7aMh1O7pN/ioPlcPt0O8NKB8/57CJyrb53Hd1GM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)