UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Dvt69MO4mG0ko6lqlrBeIFioaX2clymc8fSe8AfPvb8='
WHERE
key_id = '4e0e9e7883f74960333e61529b30e37528c13e29cee2127a930620a2baebd7f8'
AND (
token = 'Dvt69MO4mG0ko6lqlrBeIFioaX2clymc8fSe8AfPvb8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)