UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'NTFA0BzmxNvTgG/LVcYxtoAnRUfAg9GkOSr3s4u953w='
WHERE
key_id = 'f44e708effcf6010aae8eae3ca4ab72e426f54b8d022823ec38d8146243ebe2d'
AND (
token = 'NTFA0BzmxNvTgG/LVcYxtoAnRUfAg9GkOSr3s4u953w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)