UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'cWfyyA19dKDrPHpgOsz739aNNwMdJuZoK/8cOpcUHyw='
WHERE
key_id = 'a5a5a84d224c14fde4e9ef9cae1bf2ea5cac15e763a2cb4b042c82887b94a4ca'
AND (
token = 'cWfyyA19dKDrPHpgOsz739aNNwMdJuZoK/8cOpcUHyw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)