UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'yL7rBngfriS9oysMAB2EyVZDFR1qORT+U20sItrflGg=' 
WHERE 
  key_id = '828191ca9038d6584baaf1558d81be4c44107a85280453d2c18fb1b07e55afdf' 
  AND (
    token = 'yL7rBngfriS9oysMAB2EyVZDFR1qORT+U20sItrflGg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025