UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'avnttWpo10X2rPSQ0Twsd6AwN4IJWAzUVvmtW2j3OFw=' 
WHERE 
  key_id = 'd107d16051e42aad55a1e291a419d1781983050801705852d5da6ad3a3010318' 
  AND (
    token = 'avnttWpo10X2rPSQ0Twsd6AwN4IJWAzUVvmtW2j3OFw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031