UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cw8RFkSWJ7vJI5p1QrgTOoS2qAgJZ1Zd+DSalHr0zvY=' 
WHERE 
  key_id = '97f78b113dae3783f3cef2ac88fb58078f88a4d09c12a427917e2bd7d737739f' 
  AND (
    token = 'cw8RFkSWJ7vJI5p1QrgTOoS2qAgJZ1Zd+DSalHr0zvY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025