UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'F+ihwm+3KgY4YUuga5ysfukYM7N435JxNgYING7nDDs=' 
WHERE 
  key_id = 'df90aeb53bbf26f38f64b56a7fbfa8641563f3fd83685299604d6733e737d5fa' 
  AND (
    token = 'F+ihwm+3KgY4YUuga5ysfukYM7N435JxNgYING7nDDs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041