UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'MZKt2cYeplPgS3pol/c5X7Y1djFFcENcu6TktKUDgv0='
WHERE
key_id = 'd040f5f27be6aaf8ac01a328c95ff5d9e2838dd632e61210c74b18c6ad6bf658'
AND (
token = 'MZKt2cYeplPgS3pol/c5X7Y1djFFcENcu6TktKUDgv0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)