UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xchTKcD0Pr6w3gt0qWOIyPffsvFBHt0SlNq88X2X2Rs=' 
WHERE 
  key_id = '93e29e769e6f61ee051830e350d6de99cb400cc13ce2e780a091086cb0916668' 
  AND (
    token = 'xchTKcD0Pr6w3gt0qWOIyPffsvFBHt0SlNq88X2X2Rs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021