UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'CCoOlB39tENmBpJP40e0tgzYdtmn7HZp2QgVxKNnqzE='
WHERE
key_id = 'f61984ace1db0db70dabaac7ae34267d22ca2af0b3bdf7005d8e14560e997fc3'
AND (
token = 'CCoOlB39tENmBpJP40e0tgzYdtmn7HZp2QgVxKNnqzE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)