UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ki96nUWD5E7IDOrum9uKutD/AuUk0TWpvmC4WiBPJgI=' 
WHERE 
  key_id = 'aadbc48742b79c7fed46dcdb386375c587bb1bc69eab023f312b9bcab4172036' 
  AND (
    token = 'ki96nUWD5E7IDOrum9uKutD/AuUk0TWpvmC4WiBPJgI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033