UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'frTlf+sgdS6mrWJmciA8gst1bOhoe6lnCFP6jMcBhKY='
WHERE
key_id = '02a262f1bc5d7bdb3bf195464d91e009f77d8a47c0d2765197fada2c535324c7'
AND (
token = 'frTlf+sgdS6mrWJmciA8gst1bOhoe6lnCFP6jMcBhKY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)