UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '8AjOLA3nCVJyGqntczzMmFIw6lGxa+GEScIClg3mets=' 
WHERE 
  key_id = '2714ba8229e60ea004f80b8425a9deffa6f1c4155791a526a804ab08edc4e1cf' 
  AND (
    token = '8AjOLA3nCVJyGqntczzMmFIw6lGxa+GEScIClg3mets=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034